package meihua.stopcarapp.presenter;

import android.util.Log;

import meihua.mylibrary.baserx.RxSubscriber;
import meihua.stopcarapp.R;
import meihua.stopcarapp.bean.result.UserResult;
import meihua.stopcarapp.presenter.contract.SplashContract;

/**
 * Name: LGZ
 * Time: 2017/5/11.
 * Dec:
 */

public class SplashPresenter extends SplashContract.Presenter {

    @Override
    public void sendGetUser(String uid, String phone) {
        mRxManage.add(mModel.getUserById(uid, phone)
                .subscribe(new RxSubscriber<UserResult>(mContext,false) {
                    @Override
                    public void onStart() {
                        super.onStart();
                        mView.showLoading(mContext.getString(R.string.loading));
                    }
                    @Override
                    protected void _onNext(UserResult userEntity) {
                        Log.d("ligaozeng","请求成功");
                        mView.returnUserInfo(userEntity);
                        mView.stopLoading();
                    }
                    @Override
                    protected void _onError(String message) {
                        Log.d("ligaozeng","服务器错误:"+message);
                    }
                }));
    }
}
